using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using HermesPortal.Core;
using HermesPortalUI;
public partial class SagaAdmin_Controls_ListCreator : System.Web.UI.UserControl
{
   
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            listSagas.DataTextField = "Value";
            listSagas.DataValueField = "Key";
            listSagas.DataSource = HermesPortalUI.UIHelpers.GetSagaList();  
            listSagas.DataBind();

            listRoles.DataSource  = Enum.GetNames(typeof(SagaRoles));
            listRoles.DataBind(); 
        }
       
        
    }


   
    protected void CreatorRoles(object source, EventArgs e)
    {
      
    }

    protected void OnClick_Update(object source, EventArgs e)
    {
        foreach (GridViewRow row in CreatorList.Rows)
        {
            CheckBox chkSelectedChange = (CheckBox)row.FindControl("chkSelectedChange");
            if (chkSelectedChange != null)
            {
                if (chkSelectedChange.Checked)
                {
                    //int creatorId = Convert.ToInt32 (CreatorList.DataKeys[row.RowIndex].Value );
                    //UserServices.SetCreatorRoleForSaga(creatorId, Convert.ToInt32(listSagas.SelectedValue), listRoles.SelectedValue);  

                    CreatorList.UpdateRow(row.RowIndex,true);

                }
            }

        }
        
      
     
    }

}